package cj.web.sc.dao;
/*
 *  
 *  
*/
import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.sc.domain.SCCrowdFundOrderItems;

/**
 * 
 * @author 
 *
 */
@DAO
public interface SCCrowdFundOrderItemsDAO{
	
	@SQL("SELECT * FROM SCCrowdFundOrderItems WHERE 1=1 "
	    	    				    		        	+ " AND orderId=:t.orderId"
	        			    		        	+ " AND goodsItemId=:t.goodsItemId"
	        			    		        	+ " AND goodsItemName=:t.goodsItemName"
	        			    		        	+ " AND goodsItemImage=:t.goodsItemImage"
	        			    		        	+ " AND goodsItemPrice=:t.goodsItemPrice"
	        			    		        	+ " AND propValueNames=:t.propValueNames"
	        			    		        	+ " AND count=:t.count"
	        			    		        	+ " AND deleteFlag=:t.deleteFlag"
	        			    		        	+ " AND createUser=:t.createUser"
	        			    		        	+ " AND createAt=:t.createAt"
	        			    		        	+ " AND updateUser=:t.updateUser"
	        			    		        	+ " AND updateAt=:t.updateAt"
	        				+" ORDER BY updateAt DESC LIMIT :t.start,:t.length ")
    List<SCCrowdFundOrderItems> query(@SQLParam("t") SCCrowdFundOrderItems sCCrowdFundOrderItems);
    
    @SQL("select * from SCCrowdFundOrderItems where id=:id")
    SCCrowdFundOrderItems queryById(int id);
    
    @SQL("INSERT INTO SCCrowdFundOrderItems ("
    		        		+ "id,"
			        		+ "orderId,"
			        		+ "goodsItemId,"
			        		+ "goodsItemName,"
			        		+ "goodsItemImage,"
			        		+ "goodsItemPrice,"
			        		+ "propValueNames,"
			        		+ "count,"
			        		+ "deleteFlag,"
			        		+ "createUser,"
			        		+ "createAt,"
			        		+ "updateUser,"
			        		+ "updateAt,"
							+") VALUES ("
							+ ":t.id,"
							+ ":t.orderId,"
							+ ":t.goodsItemId,"
							+ ":t.goodsItemName,"
							+ ":t.goodsItemImage,"
							+ ":t.goodsItemPrice,"
							+ ":t.propValueNames,"
							+ ":t.count,"
							+ ":t.deleteFlag,"
							+ ":t.createUser,"
							+ ":t.createAt,"
							+ ":t.updateUser,"
							+ ":t.updateAt,"
					+")")
    void create(@SQLParam("t") SCCrowdFundOrderItems sCCrowdFundOrderItems);
	
	@SQL("UPDATE SCCrowdFundOrderItems SET "
		    		    						    			        + "orderId=:t.orderId,"
		        					    			        + "goodsItemId=:t.goodsItemId,"
		        					    			        + "goodsItemName=:t.goodsItemName,"
		        					    			        + "goodsItemImage=:t.goodsItemImage,"
		        					    			        + "goodsItemPrice=:t.goodsItemPrice,"
		        					    			        + "propValueNames=:t.propValueNames,"
		        					    			        + "count=:t.count,"
		        					    			        + "deleteFlag=:t.deleteFlag,"
		        					    			        + "createUser=:t.createUser,"
		        					    			        + "createAt=:t.createAt,"
		        					    			        + "updateUser=:t.updateUser,"
		        					    			        + "updateAt=:t.updateAt,"
		        						+ " WHERE id=:t.id")
    void update(@SQLParam("t") SCCrowdFundOrderItems sCCrowdFundOrderItems);
    
    @SQL("UPDATE SCCrowdFundOrderItems SET deleteFlag=0 WHERE id=:id")
    void deleteById(int id);
}